#include<iostream>
#include<string>
#include<map>

using namespace std;

int main(){
	string s;
	freopen("input.txt","r",stdin);
	getline(cin,s);
	map<char,int> m;
	for(int i=0;i<s.length();i++){
		if(s[i]>='a'&&s[i]<='z')
		m[s[i]]++;
		if(s[i]>='A'&&s[i]<='Z')
		m[s[i]+32]++;
	}
	int max_v=0;
	for(auto i:m){
		if(i.second>max_v){
			max_v=i.second;
		}
	}
	for(auto i:m){
		if(i.second==max_v){
			cout<<i.first<<" "<<i.second;
			break;
		}
	}
	return 0;

}
